﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace @try
{
    public partial class Form1 : Form
    {
        string _name;
        int _id;
//        public string TestName { get { return _name; } set { _name = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("TestName")); } }
//        public int ID { get { return _id; } set { _id = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("ID")); } }
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
            textBox1.DataBindings.Add("Text", this, "ID");
            //textBox2.DataBindings.Add("Text", this, nameof(TestName));
            //label1.DataBindings.Add("Text", this, nameof(TestName));
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Name = "Hello .Changed!!";
            
        }
    }

    //class Data :INotifyPropertyChanged {
    //    public int Id { get; set; }

    //    string _name;
    //    public string Name { get { return _name; } set { _name = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Name")); } }

    //    public event PropertyChangedEventHandler PropertyChanged;
    //}

    
}
